<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <meta name="layout" content="main"/>
  <title>Position Details</title>
</head>
<body>
<div class="nav">
  <span class="menuButton"><a class="home" href="${createLinkTo(dir: '')}">Home</a></span>
  <g:if test="${Long.parseLong(administratorId) == session.user.id}">
  %{--<span class="menuButton"><g:link class="create" action="create">New Position</g:link></span>--}%
    %{--<span class="menuButton"><g:link class="edit" controller="position" action="edit" params="[id: positionInstance.id]">Edit</g:link></span>--}%
  </g:if>
</div>
<div class="body">
  <h1>Position Details</h1>
  <g:if test="${flash.message}">
    <div class="message">${flash.message}</div>
  </g:if>
  <div class="dialog">
    <table>
      <tbody>
      <tr class="prop">
        <td valign="top" class="name">Id:</td>
        <td valign="top" class="value">${fieldValue(bean: positionInstance, field: 'id')}</td>
      </tr>
      <tr class="prop">
        <td valign="top" class="name">Name:</td>
        <td valign="top" class="value">${fieldValue(bean: positionInstance, field: 'name')}</td>
      </tr>
      <tr class="prop">
        <td valign="top" class="name">Description:</td>
        <td valign="top" class="value">${fieldValue(bean: positionInstance, field: 'description')}</td>
      </tr>
      <tr class="prop">
        <td valign="top" class="name">Location:</td>
        <td valign="top" class="value">${fieldValue(bean: positionInstance, field: 'location')}</td>
      </tr>
      <tr class="prop">
        <td valign="top" class="name">Requires:</td>
        <td valign="top" class="value">${fieldValue(bean: positionInstance, field: 'requires')}</td>
      </tr>
      <tr class="prop">
        <td valign="top" class="name">Start Date:</td>
        <td valign="top" class="value">${fieldValue(bean: positionInstance, field: 'startDate')}</td>
      </tr>
      <tr class="prop">
        <td valign="top" class="name">End Date:</td>
        <td valign="top" class="value">${fieldValue(bean: positionInstance, field: 'endDate')}</td>
      </tr>

      %{--<tr class="prop">--}%
      %{--<td valign="top" class="name">Volunteers:</td>--}%

      %{--<td valign="top" style="text-align:left;" class="value">--}%
      %{--<ul>--}%
      %{--<g:each var="v" in="${positionInstance.volunteers}">--}%
      %{--<li><g:link controller="userAccount" action="show" id="${v.id}">${v?.encodeAsHTML()}</g:link></li>--}%
      %{--</g:each>--}%
      %{--</ul>--}%
      %{--</td>--}%

      %{--</tr>--}%

      </tbody>
    </table>
  </div>
  %{--<div class="buttons">--}%
  %{--<g:form>--}%
  %{--<p>${administratorId}</p>--}%
  %{--<p>${session.user.id}</p>--}%
  %{--<g:if test="administratorId == session.user.id">--}%
  %{--<input type="hidden" name="id" value="${positionInstance?.id}"/>--}%
  %{--<input type="hidden" name="id" value="${administratorId}"/>--}%
  %{--<span class="button"><g:actionSubmit class="edit" value="Edit"/></span>--}%
  %{--<span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete"/></span>--}%
  %{--</g:if>--}%
  %{--</g:form>--}%
  %{--</div>--}%
  <h1>Volunteers</h1>
  <div class="list">
    <table>
      <thead>
      <tr>
        %{--<g:sortableColumn property="id" title="Id"/>--}%
        <g:sortableColumn property="firstName" title="First Name"/>
        <g:sortableColumn property="lastName" title="Last Name"/>
        <g:sortableColumn property="email" title="Email"/>
      </tr>
      </thead>
      <tbody>
      <g:if test="${positionInstance?.volunteers.size() == 0}">
        <tr>
          <td colspan=3>No volunteers yet</td>
        </tr>
      </g:if>
      <g:each in="${positionInstance.volunteers}" status="i" var="userAccountInstance">
        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
          <td><g:link action="show" id="${userAccountInstance.id}">${fieldValue(bean: userAccountInstance, field: 'firstName')}</g:link></td>
          %{--<td>${fieldValue(bean: userAccountInstance, field: 'firstName')}</td>--}%
          <td>${fieldValue(bean: userAccountInstance, field: 'lastName')}</td>
          <td>${fieldValue(bean: userAccountInstance, field: 'email')}</td>
        </tr>
      </g:each>
      </tbody>
    </table>
  </div>
  %{--<div class="paginateButtons">--}%
  %{--<g:paginate total="${userAccountInstanceTotal}" />--}%
  %{--</div>--}%
</div>


</body>
</html>
